package sugarbind_input



class Organism {

    String organism_Name
	String organism_Notes
	Integer taxonomy_Id

    static constraints = {
		organism_Name(blank:false)
		organism_Notes(blank:true)
		taxonomy_Id(nullable:true)
		
		organism_Name(unique:['organism_Notes'])
	}
	
	static hasMany = [areas:Area, sources:Source]
	
	static mapping = {
//		id column: 'organism_id'
		id generator: 'sequence', params: [sequence: 'organism_id_seq']
	}
	
	public String toString(){
		def organism = organism_Name
		if(organism_Notes != null && !organism_Notes.isEmpty())
		{ 
		 organism += ", " + organism_Notes
		}
		organism += " ("+ id +")"
	}
}
